package jm.demo.auth.domain;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;


@Path("/helloworld")
public class HelloWorld {
    
    @Context
    UriInfo uriInfo;

    @GET 
    // The Java method will produce content identified by the MIME Media
    // type "text/plain"
    @Produces(MediaType.TEXT_PLAIN)
    public String getClichedMessage1() {
        // Return some cliched textual content
        return "Hello World:" + uriInfo.getAbsolutePath();
    }


    
    @GET 
    // The Java method will produce content identified by the MIME Media
    // type "text/plain"
    @Produces(MediaType.APPLICATION_XML)
    @Path("/sayhi")
    public String getClichedMessage() {
        // Return some cliched textual content
        return "Hello World";
    }

    
    @GET 
    // The Java method will produce content identified by the MIME Media
    // type "text/plain"
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/address")
    public Address getMyAddress() {
        // Return some cliched textual content
        Address address = new Address();
        address.setId(1);
        address.setStreet("Beijing Jianguomen");
        return address;
    }

    @GET 
    @Produces(MediaType.APPLICATION_XML)
    @Path("/addressXml")
    public Address getMyAddressXML() {
        // Return some cliched textual content
        Address address = new Address();
        address.setId(1);
        address.setStreet("Beijing Jianguomen");
        return address;
    }


}
